/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * QuitterPartie.java
 *
 * Created on 6 juin 2009, 03:03:31
 */

package caylus.GUI;

import java.awt.Dimension;
import java.awt.Toolkit;

/**
 *
 * @author Mouna
 */
public class QuitterPartie extends javax.swing.JFrame {

    private PlateauDuJeu _PlateauDuJeu;
    /** Creates new form QuitterPartie */
    public QuitterPartie(PlateauDuJeu pPlateauDuJeu) {
        _PlateauDuJeu = pPlateauDuJeu;
        initComponents();
        centrerFenetre();
        repaint();
    }

     /**
     * methode pour centrer la fenetre dans l'ecran
     */
    private void centrerFenetre()
        {
            // on place notre fenêtre au milieu
            Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
            setLocation((screen.width - getSize().width)/2,(screen.height - getSize().height)/2);
        }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButtonOK = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jButtonCANCEL = new javax.swing.JButton();

        setTitle("Quitter");
        setResizable(false);

        jButtonOK.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/caylus_button_ok - 2.png"))); // NOI18N
        jButtonOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonOKActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel1.setText("Etes vous sûr de vouloir quitter la partie?");

        jButtonCANCEL.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/caylus_button_cancel - 2.png"))); // NOI18N
        jButtonCANCEL.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCANCELActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(34, 34, 34)
                        .addComponent(jButtonOK)
                        .addGap(38, 38, 38)
                        .addComponent(jButtonCANCEL))
                    .addComponent(jLabel1))
                .addContainerGap(66, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButtonOK)
                    .addComponent(jButtonCANCEL))
                .addGap(41, 41, 41))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed
      _PlateauDuJeu.setVisible(false);
      dispose();
       this.setVisible(false);
       dispose();
    }//GEN-LAST:event_jButtonOKActionPerformed

    private void jButtonCANCELActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCANCELActionPerformed
        this.setVisible(false);
        dispose();
}//GEN-LAST:event_jButtonCANCELActionPerformed

 

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonCANCEL;
    private javax.swing.JButton jButtonOK;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables

}
